home *** CD-ROM | disk | FTP | other *** search
- Path: li.net!jeremy
- From: jeremy@newshost.li.net (Jeremy Markman)
- Newsgroups: comp.lang.c
- Subject: Re: Please help w/seemingly simple problem...
- Date: 11 Apr 1996 01:51:26 GMT
- Organization: LI Net (Long Island Network)
- Distribution: world
- Message-ID: <4khoiu$5v3@linet06.li.net>
- References: <4ke19f$m6r@freenet.vcu.edu>
- NNTP-Posting-Host: linet01.li.net
- X-Newsreader: TIN [version 1.2 PL2]
-
- damurr@freenet.vcu.edu wrote:
- : BTW- I'm using Borland Turbo C++ 1.0
-
- : -------------------------------------------------------------------------
-
- : [ SOURCE START ]
-
- : #define string "\r"
- : scanf(string);
-
- : if (string="\r"");
- : {
- : clrscr();
- : printf(" - Options Menu - \n\n");
- : }
-
- Use getch() instead of scanf. This will read in each character as you
- type it, without echoing the character to the screen. Then, you have
- full control over what you want to do...
- Also, you cannot compare strings by testing for equality, you'd have to
- use strcmp(). When testing character or number equality, use =, not ==.
- Anyhow, in this case you don't want to compare a string anyway, you want
- to compare a character...see the code snippet below...
-
-
- char ch;
-
- if ((ch = getch()) == 0) {* This statement helps trap functions keys *}
- ch = getch();
-
- if (ch == '\n')
- {
- clrscr();
- printf("Options Menu\n");
- }
-